/**
 * 用户
 */
import http from '@/common/vmeitime-http/interface'

/**
 * 将业务所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * 
 */

/**
 * 所有科目列表
 */
export const km_list = (data)=>{
	return http.get('index.php/home/User/km_list',
	    data)
}

/**
 * 我的收藏
 */
export const my_sc = (data)=>{
	return http.get('index.php/home/User/my_sc',
	    data)
}
/**
 * 试题详情
 */
export const dt_info = (data)=>{
	return http.get('index.php/home/index/dt_info',
	    data)
}

/**
 * 取消收藏
 */
export const my_sc_qx = (data)=>{
	return http.get('index.php/home/User/my_sc_qx',
	    data)
}
/**
 * 收藏
 */
export const sc_st = (data)=>{
	return http.get('index.php/home/index/sc_st',
	    data)
}

/**
 * 购买的课程
 */
export const my_kc_list = (data)=>{
	return http.get('index.php/home/User/my_kc_list',
	    data)
}
/**
 * 购买的学习包
 */
export const my_xxb_list = (data)=>{
	return http.get('index.php/home/User/my_xxb_list',
	    data)
}
/**
 * 购买的老师批改
 */
export const my_pg_list = (data)=>{
	return http.get('index.php/home/User/my_pg_list',
	    data)
		
}
export const my_pg_info = (data)=>{
	return http.get('index.php/home/User/my_pg_info',
	    data)
}
/**
 * 提交反馈
 */
export const m_feedback_save = (data)=>{
	return http.get('index.php/home/User/m_feedback_save',
	    data)
}
/**
 * 历史反馈
 */
export const m_feedback_list = (data)=>{
	return http.get('index.php/home/User/m_feedback_list',
	    data)
}

/* 
    获取用户信息
 */
export const userInfo = (data)=>{
	return http.get('/index.php/home/Login/userinfo',
	    data)
}
/* 
    用户信息更改
 */
export const updateMaterial = (data)=>{
	return http.get('/index.php/home/Login/updateMaterial',
	    data)
}


/**
 * 上传头像
 */
export const UpHeardimage = (data)=>{
	return new Promise((reslove,reject)=>{
		uni.uploadFile({
			url: 'http://39.97.161.226/zyfk_kf/index.php/home/User/UpHeardimage', //仅为示例，非真实的接口地址
			// url:'http://uni_upload.gek6.com/index.php/index/upload',
			filePath: data,
			name: 'file',
			success: (res) => {
				reslove(res.data)
			},
			fail:(err)=>{
				reject(err)
			}
		})
		
	})

}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default {
    km_list,
	my_sc,
	my_sc_qx,
	my_kc_list,
	my_xxb_list,
	my_pg_list,
	dt_info,
	sc_st,
	m_feedback_save,
	m_feedback_list,
	userInfo,
	updateMaterial,
	UpHeardimage,
	my_pg_info
}